# python3
# -*- coding: utf-8 -*-
# @Author  : lina
# @Time    : 2018/5/22 21:20
from pylab import *
import numpy as np

mpl.rcParams['font.sans-serif'] = ['SimHei']    # 支持中文输出

#折线图
# x = [1000, 3000, 5000, 7000, 9000, 11000, 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 29000]#点的横坐标
x = np.arange(1000, 31000, 2000)
# k1 = [0.9768, 0.9814, 0.9834, 0.9834, 0.9848, 0.9842, 0.9844, 0.9854, 0.9842, 0.9846, 0.9846, 0.9846, 0.9852, 0.9848, 0.9846]#线1的纵坐标
# k2 = [0.9753, 0.9812, 0.9824, 0.9828, 0.9826, 0.9832, 0.9831, 0.9839, 0.9837, 0.9835, 0.9833, 0.9833, 0.984, 0.9836, 0.9832]#线2的纵坐标
# t1 = [0.863, 0.8852, 0.8918, 0.8954, 0.8974, 0.8974, 0.899, 0.8996, 0.9012, 0.902, 0.8998, 0.9, 0.9026, 0.9026, 0.9014]
# t2 = [0.8451, 0.8723, 0.8788, 0.8844, 0.8895, 0.8884, 0.8899, 0.8926, 0.8934, 0.8933, 0.8934, 0.8961, 0.8962, 0.8958, 0.8979]
k1 = [0.9762, 0.983, 0.9838, 0.9854, 0.9854, 0.9864, 0.9848, 0.986, 0.9854, 0.986, 0.986, 0.9854, 0.9854, 0.986, 0.9854]
k2 = [0.9746, 0.9818, 0.9829, 0.9827, 0.9837, 0.9834, 0.984, 0.9842, 0.983, 0.984, 0.9846, 0.9838, 0.9845, 0.9847, 0.9842]
t1 = [0.8402, 0.8816, 0.8868, 0.8894, 0.8914, 0.8954, 0.8938, 0.896, 0.8976, 0.8974, 0.8984, 0.9, 0.8988, 0.9014, 0.8996]
t2 = [0.8221, 0.8629, 0.8734, 0.876, 0.8811, 0.8831, 0.8858, 0.8881, 0.8882, 0.8893, 0.8896, 0.892, 0.8903, 0.8925, 0.8923]
plt.plot(x, k1, marker='o', color='r', label="MNIST验证数据集上精度")
plt.plot(x, k2, marker='o', color='g', label="MNIST测试数据集上精度")
plt.plot(x, t1, marker='*', color='r', label="Fashion-MNIST验证数据集上精度")
plt.plot(x, t2, marker='*', color='g', label="Fashion-MNIST测试数据集上精度")
plt.xticks(x)
plt.xlabel("迭代轮数")#横坐标名字
plt.ylabel("精度")#纵坐标名字
plt.legend(loc="best")#图例
plt.show()
